package com.stoa.floatlib

import android.app.Application
import android.content.Context
import android.view.View
import com.stoa.floatlib.constant.StoaFloatConstant.SHOW_FLOAT
import com.tencent.mmkv.MMKV

object StoaFloat {
    const val TAG = "StoaFloat"
    var mContentView: View? = null
    var FLOAT_SIZE_WIDTH = 174
    var FLOAT_SIZE_HEIGHT = 174
    var mainIconClickListener: MainIconClickListener? = null

    @JvmField
    var mContext: Context? = null

    @JvmStatic
    fun init(app: Application) {
        mContext = app.applicationContext
        MMKV.initialize(app)
        StoaFloatReal.init(app)
    }

    @JvmStatic
    fun show(tag: String) {
        SHOW_FLOAT = true
        StoaFloatReal.show(tag)
    }

    @JvmStatic
    fun hide(tag: String) {
        SHOW_FLOAT = false
        StoaFloatReal.hide(tag)
    }

    @JvmStatic
    fun show(view: View, tag: String, listener: MainIconClickListener) {
        mContentView = view
        mainIconClickListener = listener
        SHOW_FLOAT = true
        StoaFloatReal.show(tag)
    }
}